const common = require('./webpack.common')
const path = require('path')
const { merge } = require('webpack-merge')
// 自动清除目录插件
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
// 拷贝静态资源文件
const CopyWebpackPlugin = require('copy-webpack-plugin')
// 配置文件压缩不生成license文件
const TerserPlugin = require("terser-webpack-plugin")
module.exports = merge(common, {
  mode: 'production',
  plugins: [
    new CleanWebpackPlugin(),
    new CopyWebpackPlugin({
      patterns: [
        {
          from: path.resolve(__dirname, "public/favicon.ico")
        }
      ]
    })
  ],
  optimization: {
    minimize: true,
    minimizer: [new TerserPlugin({
      extractComments: false
    })]
  }
})